import request from '@/utils/request'

export function getMenusTree() {
  return request({
    url: 'admin/menu/listtree',
    method: 'get'
  })
}

export function get(data) {
  return request({
    url: 'admin/get-menu-list',
    method: 'get',
    params: data
  })
}

export function buildMenus() {
  return request({
    url: 'admin/menu/build',
    method: 'get'
  })
}

export function add(data) {
  return request({
    url: 'admin/create-menu',
    method: 'post',
    data
  })
}

export function del(data) {
  return request({
    url: 'admin/delete-menu',
    method: 'post',
    data
  })
}

export function edit(data) {
  return request({
    url: 'admin/menu',
    method: 'put',
    data
  })
}

export default { get, add, edit, del, getMenusTree }
